<?php
/**
 * Interview Customizing Screen
 * 
 * In this interface you will be able to customize the interview types
 * and the interview text blocks
 * 
 */

use Fox\Generator;
use Fox\Grid;
$xview = Xview::instance();

// Customizing
$customizing = Hive\Admin\Customizing::instance();
$customizing->trackSummaryPage(array('mod' => 'contacts','act'=>'wishes','sac'=>'admin'));

if(!Fox\Authorization\Manager::check(Hive\Authorizations::CONTACT_WISHES_ADM_W)) {
	echo $xview->accessDenied(Msg(Hive::BUNDLE,Hive::ERR_ADMIN_ACCES_DENIED),null,true);
	exit;
}

$screen = new Fox\Html\Screen('sGroups');
$screen->pageTitle(Msg(Hive::BUNDLE,Hive::WISHES_CUSTOMIZING));
$html = $screen->display();

// Customize Wish Mood
$gCust1 = new Grid('g1');
$gCust1->bootstrapGrid();
$gCust1->fieldcat(array('label','standard','active','iedit'))
		->switchToObjectMode()
		->setGenerators(array(
			'label' => Generator::call('label'),
			'iedit' => Generator::useValue('?')
		))
		->field('iedit')->renderer()
			->behaviors(Fox\Behaviors::action(
				Fox\Generator::url('contacts','wishes','mood_modify',array('inlineid' => Generator::call('getInLineId'))),
			true
		));
$bAction = new Fox\Html\Button('add','?',Msg(Hive::BUNDLE,Hive::ADD_A_NEW_MOOD));
$bAction->color(Fox\Html\Button::COLOR_WARNING)
		->behaviors(Fox\Behaviors::action(
			Fox\Generator::url('contacts','wishes','mood_modify'),
			true
		));
$gCust1->initialize(Hive\Contact\Wish\Mood::loadAll());
$html .= '<p class="prettyprint">'.$bAction->display().Msg(Hive::BUNDLE,Hive::LIST_OF_AVAILABLE_WISHE_MOODS).'</p>';
$html .= $gCust1->display();

// Customize Wish Company Size
$gCust2 = new Grid('g1');
$gCust2->bootstrapGrid();
$gCust2->fieldcat(array('label','standard','active','iedit'))
		->switchToObjectMode()
		->setGenerators(array(
			'label' => Generator::call('label'),
			'iedit' => Generator::useValue('?')
		));
$gCust2->fieldcat()->field('iedit')->renderer()
			->behaviors(Fox\Behaviors::action(
				Fox\Generator::url('contacts','wishes','company_modify',array('inlineid' => Generator::call('getInLineId'))),
			true
		));
$bAction2 = new Fox\Html\Button('add','?',Msg(Hive::BUNDLE,Hive::ADD_A_NEW_COMPANY_SIZE));
$bAction2->color(Fox\Html\Button::COLOR_WARNING)
		->behaviors(Fox\Behaviors::action(
			Fox\Generator::url('contacts','wishes','company_modify'),
			true
		));
$gCust2->initialize(Hive\Contact\Wish\Company\Size::loadAll());
$html .= '<br><p class="prettyprint">'.$bAction2->display().Msg(Hive::BUNDLE,Hive::LIST_OF_WISHES_COMPANIES_SIZE).'</p>';
$html .= $gCust2->display();

return '<div class="source {\'uri\':\'?mod=contacts&act=wishes&sac=admin\'}" >'.$html.'</div>';